import * as types from '../action/ActionTypes';

const defaultState = {
  currentRouter: '',
  roomKey: '',
  navigationStack: [],
  widgetLayout: {
    show: false,
    bottom: 0,
    height: 100,
  },
};

export default function userReducer(state = defaultState, action) {
  // console.log(action);
  switch (action.type) {
    case types.ROOM_WIDGET_LAYOUT:
      return {
        ...state,
        widgetLayout: {
          ...state.widgetLayout,
          ...action.layout,
        },
      };
    case types.ROUTER_STACK:
      return {
        ...state,
        navigationStack: action.stack,
      };
    case types.SET_ROOM_KEY:
      return {
        ...state,
        roomKey: action.key,
      };
    default:
      return state;
  }
}
